/**
 * Created by luojie on 2018/3/14.
 * 报名列表
 */

const noMember = require("../images/no-member.png");
export default class Apply extends React.PureComponent {
	constructor(props) {
		super(props);
		this.checkOrder = this.checkOrder.bind(this);
	}
	checkOrder(id) {
		let { onClick } = this.props;
		onClick && onClick(id);
	}
	render() {
		let { list } = this.props;
		if (!list.length) {
			return (
				<div>
					<img className="no-member" src={noMember} alt="" />
				</div>
			)
		}
		return (
			<div className="my-member-wrapper">
				{
					list.map((item, index) => {
						return (
							<div className="my-member-list-row" key={index}>
								<div className="my-member-input-row">
									<span className="input-label">会员名</span>
									<div className="my-member-info">{item.userName}</div>
									<div className="my-member-discount-tip">
										{
											item.isBuyClass ? (
												<div>
													<div>
														<span>终身<span className="discount-color">九折</span>优享中</span>
													</div>
													<div className="my-member-discount-tip-other">
														<span>首单<span className="discount-color">五折</span>已使用</span>
													</div>
												</div>
											):(
												<div>
													<div>
														<span>首单<span className="discount-color">五折</span>未使用</span>
													</div>
													<div>
														<span>终身<span className="discount-color">九折</span>优享中</span>
													</div>
												</div>
											)
									}
									</div>
								</div>
								<div className="my-member-input-row">
									<span className="input-label">年龄</span>
									<div className="my-member-info">{item.age}</div>
								</div>

								<div className="my-member-handle-row">
									<button onClick={this.checkOrder.bind(this,item.vipId || null)}>查看已报课程</button>
								</div>
							</div>
						)
					})
				}
			</div>
		)
	}
}

